/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.Vector;

/**
 *
 * @author Christopher
 */
public class Assignment3 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        Assignment3 assignment3 = new Assignment3();
        GeneticAlgorithm geneticAlgorithm = new GeneticAlgorithm();
        
        System.out.println("How many cities are there to visit?");
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Integer cityCount = new Integer(br.readLine());
        
        System.out.println("How many chromosomes in the initial population?");
        br = new BufferedReader(new InputStreamReader(System.in));
        Integer chromosomeCount = new Integer(br.readLine());
        geneticAlgorithm.generateInitialPopulation(chromosomeCount.intValue(), cityCount.intValue());
        
        System.out.println("What is the probability of crossover?");
        br = new BufferedReader(new InputStreamReader(System.in));
        Double crossoverProbability = new Double(br.readLine());
        geneticAlgorithm.crossoverProbability(crossoverProbability.doubleValue());
        int i=0;
        boolean stop = false;
        while(i<400 && !stop)
        {
            stop = geneticAlgorithm.selectNextPopulation();
            i++;
        }
        geneticAlgorithm.closeWriter();
    }
    
    
    
}
